using System;
using System.Web.UI.WebControls;
using System.Web.UI;
using System.ComponentModel;
using System.ComponentModel.Design;
using AjaxControlToolkit;

[assembly: System.Web.UI.WebResource("AJAXControls.HelpPopupBehavior.js", "text/javascript")]
[assembly: System.Web.UI.WebResource("AJAXControls.close.gif", "image/gif")]
namespace AJAXControls
{
    /// <summary>
    /// This class is used to get and set the propeties used for HelpPopup functionality.
    /// </summary>
    [Designer(typeof(HelpPopupDesigner))]
    [ClientScriptResource("AJAXControls.HelpPopupBehavior", "AJAXControls.HelpPopupBehavior.js")]
    [RequiredScript(typeof(CommonToolkitScripts))]
    [RequiredScript(typeof(PopupExtender))]
    [TargetControlType(typeof(Control))]
    public class HelpPopupExtender : ExtenderControlBase
    {
        /// <summary>
        ///  This property is to set the CloseImageUrl of the baloon
        ///  Property type 'url'
        ///  By default the control itself embedded with an image.
        ///  This property is optional.
        /// </summary>
        [DefaultValue("")]
        [UrlProperty]
        [ExtenderControlProperty]
        [ClientPropertyName("closeImageUrl")]
        public virtual string CloseImageUrl
        {
            get { return GetPropertyValue("CloseImageUrl", (string)null) ?? Page.ClientScript.GetWebResourceUrl(typeof(HelpPopupExtender), "AJAXControls.close.gif"); }
            set { SetPropertyValue("CloseImageUrl", value); }
        }

        /// <summary>
        ///  This property will set the path of the webservice method name to consume.
        ///  This method should contain the following parameters and parameter names should be exactly as given below
        ///  param1 : string entity
        ///  param2 : string attribute
        ///  You can give your own method name.
        ///  Property type 'string'
        ///  This property is mandatory.
        /// </summary>
        [RequiredProperty]
        [ExtenderControlProperty]
        [ClientPropertyName("serviceMethod")]
        public virtual string ServiceMethod
        {
            get { return GetPropertyValue("ServiceMethod", String.Empty); }
            set { SetPropertyValue("ServiceMethod", value); }
        }


        /// <summary>
        /// This property will set the path of the webservice file to consume.
        ///  Property type 'string'
        ///  This property is mandatory.
        /// </summary>
        [UrlProperty]
        [RequiredProperty]
        [ExtenderControlProperty]
        [TypeConverter(typeof(ServicePathConverter))]
        [ClientPropertyName("servicePath")]
        public virtual string ServicePath
        {
            get { return GetPropertyValue("ServicePath", String.Empty); }
            set { SetPropertyValue("ServicePath", value); }
        }

        /// <summary>
        ///  This property will set the entity name to fetch the description.
        ///  Property type 'string'
        ///  This property is optional.
        /// </summary>
        [ExtenderControlProperty]
        [DefaultValue("")]
        [ClientPropertyName("entityName")]
        public virtual string EntityName
        {
            get
            {
                return GetPropertyValue("EntityName", "");
            }
            set
            {
                SetPropertyValue("EntityName", value);
            }
        }

        /// <summary>
        ///  This property will set the attributeName name of the entity to fetch the description.
        ///  Property type 'string'
        ///  This property is optional.
        /// </summary>
        [ExtenderControlProperty]
        [DefaultValue("")]
        [ClientPropertyName("attributeName")]
        public virtual string AttributeName
        {
            get
            {
                return GetPropertyValue("AttributeName", "");
            }
            set
            {
                SetPropertyValue("AttributeName", value);
            }
        }

        /// <summary>
        ///  This property will set the background color of the baloon popup.
        ///  Property type 'string'
        ///  This property is optional.
        /// </summary>
        [ExtenderControlProperty]
        [DefaultValue("")]
        [ClientPropertyName("fillColor")]
        public virtual string FillColor
        {
            get
            {
                return GetPropertyValue("FillColor", "");
            }
            set
            {
                SetPropertyValue("FillColor", value);
            }
        }

        /// <summary>
        ///  This property will set the fore color of the baloon popup.
        ///  Property type 'string'
        ///  This property is optional.
        /// </summary>
        [ExtenderControlProperty]
        [DefaultValue("")]
        [ClientPropertyName("textColor")]
        public virtual string TextColor
        {
            get
            {
                return GetPropertyValue("TextColor", "");
            }
            set
            {
                SetPropertyValue("TextColor", value);
            }
        }

        /// <summary>
        ///  This property will set the width of the baloon popup.
        ///  Property type 'string'
        ///  This property is optional.
        /// </summary>
        [ExtenderControlProperty]
        [DefaultValue(200)]
        [ClientPropertyName("width")]
        public virtual int Width
        {
            get
            {
                return GetPropertyValue("Width", 200);
            }
            set
            {
                SetPropertyValue("Width", value);
            }
        }

    }
}
